Continuations in Prolog

نویسندگان

  • Pascal Brisset
  • Olivier Ridoux
چکیده

Continuations are well known in functional programming where they have been used to transform and compile programs. Some languages provide explicit manipulations of the continuation for the user: The user can catch and modify the current continuation. Continuations have also been used in the logic programming context to give a denotational semantics for Prolog, to generate Prolog compilers and to transform Prolog programs. In this paper, we propose to introduce new built-ins in a logic programming language to enable the user to explicitly replace the continuations. These built-ins allow the user to have a new control of the execution. We choose Prolog because of its higher-order syntax and implications in the goals which are necessary for the deenition and use of these built-ins. In order to deene the built-ins, we extend to Prolog the Prolog semantics based on continuations. Then, we show that an exception mechanism can be easily implemented using these new built-ins. The proposed semantics is also used to prove equivalence of goals changing the continuations.

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Delimited continuations for prolog

Delimited continuations are a famous control primitive that originates in the functional programming world. It allows the programmer to suspend and capture the remaining part of a computation in order to resume it later. We put a new Prolog-compatible face on this primitive and specify its semantics by means of a metainterpreter. Moreover, we establish the power of delimited continuations in Pr...

متن کامل

Delimited Continuations in Prolog: Semantics, Use, and Implementation in the WAM

An implementation of a delimited continuations, known in the functional programming world, is shown in the context of the WAM, and more particular in hProlog. Three new predicates become available to the user: reset/3 and shift/1 for delimiting and capturing the continuation, and call continuation/1 for calling it. The underlying low-level built-ins and modifications to the system are described...

متن کامل

Dealing with Explicit Exceptions in Prolog

Existing logic languages provide some simple "extra-logical" constructs for control manipulation , such as the cut of standard Prolog and the exception handling constructs of other versions of Prolog (e.g. SICStus Prolog). Aspects speciically concerning the ow of control in a language can be quite naturally modelled by means of the Denotational Semantics, and in particular the Denotational Sema...

متن کامل

Continuation Prolog: A new intermediary language for WAM and BinWAM code generation

We present a new intermediary language suitable for program transformations that fills the gap between Prolog source level and lower representations like binary Prolog or WAM-code. With the help of Continuation Prolog transformations on the level of continuations can be expressed that are unavailable in the usual settings of WAM-code generation.

متن کامل

PRISM Revisited: Declarative Implementation of a Probabilistic Programming Language Using Delimited Control

PRISM is a probabilistic programming language based on Prolog augmented with primitives to represent probabilistic choice. PRISM is implemented using a combination of low level support from a modified version of B-Prolog, source level program transformation, and libraries for probabilistic inference and learning implemented in the imperative language C. More recently, developers of probabilisti...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 1993